package org.rabbit.config;


import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class TopicRabbitmqConfig {

	@Bean
	//创建一个人普通队列
	public Queue queue3() {
		return new Queue("tpoic1"); 
	}
	
	@Bean
	//创建一个人普通队列
	public Queue queue4() {
		return new Queue("tpoic2"); 
	}
	
	
	//创建交换机和队列绑定
	@Bean
	public TopicExchange topicExchange() {
		return new TopicExchange("topicExchange");
	}
	
	@Bean
	public Binding binding3() {
		return BindingBuilder.bind(queue3()).to(topicExchange()).with("#.a.c");
	}
	
	@Bean
	public Binding binding4() {
		return BindingBuilder.bind(queue4()).to(topicExchange()).with("r.a.c");
	}
	
	
}
